import dt from '@dt/dt'

let _this = null

function options(vm, head) {
  _this = vm
  return [
  {
    field: 'handles',
    title: '选择',
    width: 60,
    slots: {
      default: (params, h) => {
        return [h('Radio', {
          props: {
            value: _this.selected == params.row.userId,
            disabled: _this.receiverFlag && params.row.isReceiver != 1
          },
          on: {
            'on-change': () => {
              _this.selected = params.row.userId
              _this.userName = `${params.row.userName}(${params.row.workNo})`
            }
          }
        })]
      }
    }
  },
  {
    field: 'userName',
    title: '姓名',
    slots: {
      default: (params, h) => {
        return params.row.isReceiver == 1 && _this.receiverFlag ?
          `${params.row.userName}（承接人）` : params.row
          .userName
      }
    }
  },
  {
    field: 'phone',
    title: '手机号码',
  }, ]
}

export default {
  options
}